package com.hzlx;

import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class ConsumerController {
    @Resource
    RestTemplate restTemplate;  // 注入远程调用对象
    @GetMapping("/hello")
    public String hello(){
        String result = restTemplate.getForObject("http://producer-demo/producer",String.class);
        return "hello:"+result;
    }
}
